package com.leetcode.No1877;

import java.util.Arrays;

/**
 * @program: leetcode
 * @description: 数组中最大数对和的最小值
 * @author: wangzhihua
 * @date: 2021-07-20
 */
public class Solution01 {

	public int minPairSum(int[] nums) {
		Arrays.sort(nums);

		int n = nums.length;
		int m = n >> 1;

		int ans = 0;

		for (int i = 0; i < m; ++i) {
			ans = Math.max(ans, nums[i] + nums[n - i - 1]);
		}

		return ans;
	}

}
